#include "desktopUI.h"

desktopUI::desktopUI(QWidget *parent)
    :QDialog(parent)
{
    QDesktopWidget * desktopWidget = QApplication::desktop();
    //available geometry
    //QRect deskRect = desktopWidget->availableGeometry();
    //screen geometry
    QRect screenRect = desktopWidget->screenGeometry();

    qint32 _width = screenRect.width();
    qint32 _height = screenRect.height();
    //g_nActScreenX = deskRect.width();
    //g_nActScreenY = deskRect.height();

    //initPosSize(_width,_height);

    //get screen count（screen copy ,return 1）
    //qint32 g_nScreenCount = desktopWidget->screenCount();
    initPosSize(_width,_height);


    _pCalendarUI = new Calendar(QPoint(gCalendarX,gCalendarY),QSize(gCalendarWidth,gCalendarHeight));
    _pCalendarUI->setWindowOpacity(0.8);

    _pNoteTaskUI = new NoteTask(_width,_height,_pCalendarUI->getItemMap());
    _pNoteTaskUI->setWindowOpacity(0.8);

    connect(_pCalendarUI->_pCalendarWindow->ui_editItemDialog,SIGNAL(slotSave()),this,SLOT(update()));

}

//desktopUI::~desktopUI()
//{

//}

void desktopUI::initPosSize(qint32 screenWidth,qint32 screenHeigh)
{
    gNoteTaskWidth  = screenWidth/4;
    gCalendarWidth  = 820;//screenWidth/2;
    gCalendarHeight = 290;//screenHeigh/2;
    gCalendarX = gNoteTaskWidth;
    gCalendarY = screenHeigh/8;
}

void desktopUI::show()
{
    _pCalendarUI->show();
    _pNoteTaskUI->show();
}

void desktopUI::update()
{
    _pNoteTaskUI->update(_pCalendarUI->getItemMap());
}
